﻿//Copyright (c) Chris Pietschmann 2013 (http://pietschsoft.com)
//Licensed under the GNU Library General Public License (LGPL)
//License can be found here: http://easypatterns.codeplex.com/license

using EasyPatterns.Factory;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace EasyPatterns.Test.Factory
{
    [TestClass]
    public class ParameterFactoryTest
    {
        [TestMethod]
        public void Create_001()
        {
            var target = new MyParameterFactory();

            var actual = target.Create(1);

            Assert.AreEqual("int = 1", actual);
        }

        [TestMethod]
        public void Create_002()
        {
            IParameterFactory target = new MyParameterFactory();

            var actual = target.Create(42);

            Assert.AreEqual("int = 42", actual);
        }

        public class MyParameterFactory : ParameterFactory<string, int>
        {
            protected override string CreateInstance(int parameterValue)
            {
                return "int = " + parameterValue.ToString();
            }
        }
    }

}
